﻿using System.Data;
using DTO;

namespace DAO
{
    public class KhachHang_Dao 
    {
        private readonly BaseOperationImplement<NhanVien_Dto> _operationImp = new BaseOperationImplement<NhanVien_Dto>();

        public DataTable GetAllObject()
        {
            return _operationImp.GetAllObject("KhachHang");
        }

        public int AddObject(KhachHang_Dto obj)
        {
            return _operationImp.AddObject("insKhachHang", CommandType.StoredProcedure, "@id", obj.MaKH, "@diachi",
                                           obj.DiaChi);
        }

        public int EditObject(string id, KhachHang_Dto newObj)
        {
            return _operationImp.EditObject("updateKhachHang", CommandType.StoredProcedure, "@id", id, "@diachi",
                                            newObj.DiaChi);
        }

        public int DeleteObject(string id)
        {
            return _operationImp.DeleteObject("delKhachHang", CommandType.StoredProcedure, "@id", id);
        }

        public int AutoIncrementIDObject()
        {
            return _operationImp.AutoIncrementIdObject("KhachHang", "MaKH");
        }
    }
}